const express = require('express')

const app = express()

app.get('/home', (req, res) => {
    // 原生http获取报文方式
    console.log(req.method)
    console.log(req.url)
    console.log(req.httpVersion)
    console.log(req.headers)

    // express获取报文方式
    // 获取路径
    console.log(req.path)
    // 获取ip
    console.log(req.ip)
    // 获取查询参数
    console.log(req.query)
    // 获取指定的请求头
    console.log(req.get('host'))

    res.send('首页')
})

app.listen(3000, () => {
    console.log('server is running port 3000')
})